package org.lwjgltutorial.chapter2;

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import static org.lwjgl.opengl.GL11.*;

public class SimpleSquare {
	public static void main(String[] args) throws InterruptedException{
	try {
		Display.setTitle("Simple Square");
		Display.create();
	} catch (LWJGLException e) {
		e.printStackTrace();
	}
	
	// draw the square
	glBegin(GL_LINE_LOOP);
		glVertex3f(-0.5f, -0.5f, 0f);
		glVertex3f(-0.5f, 0.5f, 0f);
		glVertex3f(0.5f, 0.5f, 0f);
		glVertex3f(0.5f, -0.5f, 0f);
	glEnd();
	
	// flush any commands that are still hanging about.
	glFlush();
	// update window.
	Display.update();
	
	while(!Display.isCloseRequested()){
		Thread.sleep(100);		
	}
	Display.destroy();
	}
}

